import Vue from 'vue';
import Router from 'vue-router';
/* Layout */
import Layout from '@/layout';

Vue.use(Router);

/**
 * Note: 路由配置项
 *
 * hidden: true                   // 当设置 true 的时候该路由不会再侧边栏出现 如401，login等页面，或者如一些编辑页面/edit/1
 * alwaysShow: true               // 当你一个路由下面的 children 声明的路由大于1个时，自动会变成嵌套的模式--如组件页面
 *                                // 只有一个时，会将那个子路由当做根路由显示在侧边栏--如引导页面
 *                                // 若你想不管路由下面的 children 声明的个数都显示你的根路由
 *                                // 你可以设置 alwaysShow: true，这样它就会忽略之前定义的规则，一直显示根路由
 * redirect: noRedirect           // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
 * name:'router-name'             // 设定路由的名字，一定要填写不然使用<keep-alive>时会出现各种问题
 * meta : {
    noCache: true                // 如果设置为true，则不会被 <keep-alive> 缓存(默认 false)
    title: 'title'               // 设置该路由在侧边栏和面包屑中展示的名字
    icon: 'svg-name'             // 设置该路由的图标，对应路径src/assets/icons/svg
    breadcrumb: false            // 如果设置为false，则不会在breadcrumb面包屑中显示
    activeMenu: '/system/user'   // 当路由设置了该属性，则会高亮相对应的侧边栏。
  }
 */

// 公共路由
export const constantRoutes = [
	{
	    path: '/redirect',
	    component: Layout,
	    hidden: true,
	    children: [
			{
				path: '/redirect/:path(.*)',
				component: (resolve) => require(['@/views/redirect'], resolve)
			}
	    ]
    },
	{
		path: '/login',
		component: (resolve) => require(['@/views/login/index'], resolve),
		hidden: true
	},
	{
		path: '/404',
		component: (resolve) => require(['@/views/error/404'], resolve),
		hidden: true
	},
	{
		path: '/401',
		component: (resolve) => require(['@/views/error/401'], resolve),
		hidden: true
	},
	{
		path: '/foreBigScreen',
		name: 'foreBigScreen',
		component: (resolve) => require(['@/views/production/productOpenCloseMachine/components/bigScreen/fore-big-screen'], resolve),
		hidden: true
	},
	{
		path: '/afterBigScreen',
		name: 'afterBigScreen',
		component: (resolve) => require(['@/views/production/productOpenCloseMachine/components/bigScreen/after-big-screen'], resolve),
		hidden: true
	},
  {
    path: '/weighingOrder',
    name: 'weighingOrder',
    component: (resolve) => require(['@/views/putInWarehouse/rawCotton/weighingOrder/print'], resolve),
    hidden: true
  },
  {
    path: '/inspectionReport',
    name: 'inspectionReport',
    component: (resolve) => require(['@/views/putInWarehouse/rawCotton/inspectionReport/print'], resolve),
    hidden: true
  },
	{
		path: '/',
		component: Layout,
		redirect: 'index',
		children: [
			{
				path: 'index',
				component: (resolve) => require(['@/views/workbench/index'], resolve),
				name: '工作台',
				meta: { title: '工作台', icon: 'el-icon-house', affix: true, noCache: true }
			}
		]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [
			{
				path: '/personalCenter',
				component: (resolve) => require(['@/views/personalCenter/index'], resolve),
				name: 'personalCenter',
				meta: { title: '个人中心', icon: 'el-icon-house', affix: false, noCache: false, breadcrumb: false }
			}
		]
	},
	{
		path: '/codegen',
		component: Layout,
		hidden: true,
		children: [
			{
				path: 'edit/:tableId(\\d+)',
				component: (resolve) => require(['@/views/infra/codegen/editTable'], resolve),
				name: 'GenEdit',
				meta: { title: '修改生成配置', activeMenu: '/infra/codegen' }
			}
		]
	},
	{
		path: '/job',
		component: Layout,
		hidden: true,
		children: [{
			path: 'log',
			component: (resolve) => require(['@/views/infra/job/log'], resolve),
			name: 'InfraJobLog',
			meta: { title: '调度日志', activeMenu: '/infra/job' }
		}
		]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'addTechnology',
			component: (resolve) => require(['@/views/technology/order/add'], resolve),
			name: 'addTechnology',
			meta: { title: '新增-工艺单', icon: '', activeMenu: '/sheet/technologyOrder', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'editTechnology',
			component: (resolve) => require(['@/views/technology/order/edit'], resolve),
			name: 'editTechnology',
			meta: { title: '编辑-工艺单', icon: '', activeMenu: '/sheet/technologyOrder', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'detailTechnology',
			component: (resolve) => require(['@/views/technology/order/detail'], resolve),
			name: 'detailTechnology',
			meta: { title: '工艺单-详情', icon: '', activeMenu: '/sheet/technologyOrder', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'addPrdOrder',
			component: (resolve) => require(['@/views/production/order/add'], resolve),
			name: 'addPrdOrder',
			meta: { title: '新增-生产订单', icon: '', activeMenu: '/production/prdOrder', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'editPrdOrder',
			component: (resolve) => require(['@/views/production/order/edit'], resolve),
			name: 'editPrdOrder',
			meta: { title: '编辑-生产订单', icon: '', activeMenu: '/production/prdOrder', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'detailPrdOrder',
			component: (resolve) => require(['@/views/production/order/detail'], resolve),
			name: 'detailPrdOrder',
			meta: { title: '生产订单-详情', icon: '', activeMenu: '/production/prdOrder', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'addProductionNoticeOrder',
			component: (resolve) => require(['@/views/production/productionNoticeOrder/add'], resolve),
			name: 'addProductionNoticeOrder',
			meta: { title: '新增-生产通知单', icon: '', activeMenu: '/production/productionNoticeOrder', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'editProductionNoticeOrder',
			component: (resolve) => require(['@/views/production/productionNoticeOrder/edit'], resolve),
			name: 'editProductionNoticeOrder',
			meta: { title: '编辑-生产通知单', icon: '', activeMenu: '/production/productionNoticeOrder', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'detailProductionNoticeOrder',
			component: (resolve) => require(['@/views/production/productionNoticeOrder/detail'], resolve),
			name: 'detailProductionNoticeOrder',
			meta: { title: '生产通知单-详情', icon: '', activeMenu: '/production/productionNoticeOrder', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'addProductConfigCotton',
			component: (resolve) => require(['@/views/production/qhPrd/productConfigCotton/add'], resolve),
			name: 'addProductConfigCotton',
			meta: { title: '新增-配棉方案', icon: '', activeMenu: '/production/qhPrd/productConfigCotton', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'editProductConfigCotton',
			component: (resolve) => require(['@/views/production/qhPrd/productConfigCotton/edit'], resolve),
			name: 'editProductConfigCotton',
			meta: { title: '编辑-配棉方案', icon: '', activeMenu: '/production/qhPrd/productConfigCotton', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'detailProductConfigCotton',
			component: (resolve) => require(['@/views/production/qhPrd/productConfigCotton/detail'], resolve),
			name: 'detailProductConfigCotton',
			meta: { title: '配棉方案-详情', icon: '', activeMenu: '/production/qhPrd/productConfigCotton', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'addCollectMaterial',
			component: (resolve) => require(['@/views/production/qhPrd/collectMaterial/add'], resolve),
			name: 'addCollectMaterial',
			meta: { title: '新增-原料申领', icon: '', activeMenu: '/production/qhPrd/collectMaterial', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'editCollectMaterial',
			component: (resolve) => require(['@/views/production/qhPrd/collectMaterial/edit'], resolve),
			name: 'editCollectMaterial',
			meta: { title: '编辑-原料申领', icon: '', activeMenu: '/production/qhPrd/collectMaterial', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'detailCollectMaterial',
			component: (resolve) => require(['@/views/production/qhPrd/collectMaterial/detail'], resolve),
			name: 'detailCollectMaterial',
			meta: { title: '原料申领-详情', icon: '', activeMenu: '/production/qhPrd/collectMaterial', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'addForeSpinningPlan',
			component: (resolve) => require(['@/views/production/foreSpinPrd/foreSpinningPlan/add'], resolve),
			name: 'addForeSpinningPlan',
			meta: { title: '新增-前纺计划', icon: '', activeMenu: '/production/foreSpinningPlan', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'editForeSpinningPlan',
			component: (resolve) => require(['@/views/production/foreSpinPrd/foreSpinningPlan/edit'], resolve),
			name: 'editForeSpinningPlan',
			meta: { title: '编辑-前纺计划', icon: '', activeMenu: '/production/foreSpinningPlan', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'detailForeSpinningPlan',
			component: (resolve) => require(['@/views/production/foreSpinPrd/foreSpinningPlan/detail'], resolve),
			name: 'detailForeSpinningPlan',
			meta: { title: '前纺计划-详情', icon: '', activeMenu: '/production/foreSpinningPlan', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'addProductionReport',
			component: (resolve) => require(['@/views/production/productionReport/add'], resolve),
			name: 'addProductionReport',
			meta: { title: '新增-生产报工', icon: '', activeMenu: '/production/productionReport', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'editProductionReport',
			component: (resolve) => require(['@/views/production/productionReport/edit'], resolve),
			name: 'editProductionReport',
			meta: { title: '编辑-生产报工', icon: '', activeMenu: '/production/productionReport', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'detailProductionReport',
			component: (resolve) => require(['@/views/production/productionReport/detail'], resolve),
			name: 'detailProductionReport',
			meta: { title: '生产报工-详情', icon: '', activeMenu: '/production/productionReport', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'addMonthEndReport',
			component: (resolve) => require(['@/views/production/monthEndReport/add'], resolve),
			name: 'addMonthEndReport',
			meta: { title: '新增-月末报工', icon: '', activeMenu: '/production/monthEndReport', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'editMonthEndReport',
			component: (resolve) => require(['@/views/production/monthEndReport/edit'], resolve),
			name: 'editMonthEndReport',
			meta: { title: '编辑-月末报工', icon: '', activeMenu: '/production/monthEndReport', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'detailMonthEndReport',
			component: (resolve) => require(['@/views/production/monthEndReport/detail'], resolve),
			name: 'detailMonthEndReport',
			meta: { title: '月末报工-详情', icon: '', activeMenu: '/production/monthEndReport', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'addLtReport',
			component: (resolve) => require(['@/views/production/ltPrd/productionReport/add'], resolve),
			name: 'addLtReport',
			meta: { title: '新增-络筒生产报工', icon: '', activeMenu: '/production/ltPrd/ltReport', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'editLtReport',
			component: (resolve) => require(['@/views/production/ltPrd/productionReport/edit'], resolve),
			name: 'editLtReport',
			meta: { title: '编辑-络筒生产报工', icon: '', activeMenu: '/production/ltPrd/ltReport', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'detailLtReport',
			component: (resolve) => require(['@/views/production/ltPrd/productionReport/detail'], resolve),
			name: 'detailLtReport',
			meta: { title: '络筒生产报工-详情', icon: '', activeMenu: '/production/ltPrd/ltReport', affix: false }
		}]
	},
	{
		path: '/printRenovate',
		name: 'printRenovate',
		hidden: true,
		component: (resolve) => require(['@/views/production/renovatePlan/print'], resolve)
	},
	{
		path: '/printTechnology',
		name: 'printTechnology',
		hidden: true,
		component: (resolve) => require(['@/views/production/technologySet/print'], resolve)
	},
	{
		path: '/printOrder',
		name: 'printOrder',
		hidden: true,
		component: (resolve) => require(['@/views/production/order/print'], resolve)
	},
	{
		path: '/printForeSpinningPlan',
		name: 'printForeSpinningPlan',
		hidden: true,
		component: (resolve) => require(['@/views/production/foreSpinPrd/foreSpinningPlan/print'], resolve)
	},
	{
		path: '/printFrontMachineReport3',
		name: 'printFrontMachineReport3',
		hidden: true,
		component: (resolve) => require(['@/views/statisticAnalysis/frontGroupYieldStatistics/print'], resolve)
	},
	{
		path: '/printXsDailyGroupYieldNew',
		name: 'printXsDailyGroupYieldNew',
		hidden: true,
		component: (resolve) => require(['@/views/statisticAnalysis/xsDailyGroupYieldNew/print'], resolve)
	},
	{
		path: '/printXsAndLtDailyReport',
		name: 'printXsAndLtDailyReport',
		hidden: true,
		component: (resolve) => require(['@/views/statisticAnalysis/xsAndLtDailyReport/print'], resolve)
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'addFrontGroupYield',
			component: (resolve) => require(['@/views/statisticAnalysis/frontGroupYieldStatistics/add'], resolve),
			name: 'addFrontGroupYield',
			meta: { title: '新增-人员产量工资审核', icon: '', activeMenu: '/salaryStatistics/frontGroupYieldStatistics', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'editFrontGroupYield',
			component: (resolve) => require(['@/views/statisticAnalysis/frontGroupYieldStatistics/edit'], resolve),
			name: 'editFrontGroupYield',
			meta: { title: '编辑-人员产量工资审核', icon: '', activeMenu: '/salaryStatistics/frontGroupYieldStatistics', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'detailFrontGroupYield',
			component: (resolve) => require(['@/views/statisticAnalysis/frontGroupYieldStatistics/detail'], resolve),
			name: 'detailFrontGroupYield',
			meta: { title: '详情-人员产量工资审核', icon: '', activeMenu: '/salaryStatistics/frontGroupYieldStatistics', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'addXsDailyGroupYieldNew',
			component: (resolve) => require(['@/views/statisticAnalysis/xsDailyGroupYieldNew/add'], resolve),
			name: 'addXsDailyGroupYieldNew',
			meta: { title: '新增-细纱日产量工资表New', icon: '', activeMenu: '/salaryStatistics/xsDailyGroupYieldNew', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'editXsDailyGroupYieldNew',
			component: (resolve) => require(['@/views/statisticAnalysis/xsDailyGroupYieldNew/edit'], resolve),
			name: 'editXsDailyGroupYieldNew',
			meta: { title: '编辑-细纱日产量工资表New', icon: '', activeMenu: '/salaryStatistics/xsDailyGroupYieldNew', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'detailXsDailyGroupYieldNew',
			component: (resolve) => require(['@/views/statisticAnalysis/xsDailyGroupYieldNew/detail'], resolve),
			name: 'detailXsDailyGroupYieldNew',
			meta: { title: '详情-细纱日产量工资表New', icon: '', activeMenu: '/salaryStatistics/xsDailyGroupYieldNew', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'addLtGroupYieldStatistics',
			component: (resolve) => require(['@/views/statisticAnalysis/ltGroupYieldStatistics/add'], resolve),
			name: 'addLtGroupYieldStatistics',
			meta: { title: '新增-络筒班组产量统计', icon: '', activeMenu: '/salaryStatistics/ltGroupYieldStatistics', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'editLtGroupYieldStatistics',
			component: (resolve) => require(['@/views/statisticAnalysis/ltGroupYieldStatistics/edit'], resolve),
			name: 'editLtGroupYieldStatistics',
			meta: { title: '编辑-络筒班组产量统计', icon: '', activeMenu: '/salaryStatistics/ltGroupYieldStatistics', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'detailLtGroupYieldStatistics',
			component: (resolve) => require(['@/views/statisticAnalysis/ltGroupYieldStatistics/detail'], resolve),
			name: 'detailLtGroupYieldStatistics',
			meta: { title: '详情-络筒班组产量统计', icon: '', activeMenu: '/salaryStatistics/ltGroupYieldStatistics', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'addCustomerQuotation',
			component: (resolve) => require(['@/views/pricing/customerQuotation/add'], resolve),
			name: 'addCustomerQuotation',
			meta: { title: '新增-核价记录', icon: '', activeMenu: '/pricing/customerQuotation', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'editCustomerQuotation',
			component: (resolve) => require(['@/views/pricing/customerQuotation/edit'], resolve),
			name: 'editCustomerQuotation',
			meta: { title: '编辑-核价记录', icon: '', activeMenu: '/pricing/customerQuotation', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'detailCustomerQuotation',
			component: (resolve) => require(['@/views/pricing/customerQuotation/detail'], resolve),
			name: 'detailCustomerQuotation',
			meta: { title: '核价记录-详情', icon: '', activeMenu: '/pricing/customerQuotation', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'addWorkshopScheduleShiftAttendanceStatistic',
			component: (resolve) => require(['@/views/personnel/workshopScheduleShiftAttendanceStatistic/add'], resolve),
			name: 'addWorkshopScheduleShiftAttendanceStatistic',
			meta: { title: '新增-区域班次考勤记录', icon: '', activeMenu: '/personnel/workshopScheduleShiftAttendanceStatistic', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'editWorkshopScheduleShiftAttendanceStatistic',
			component: (resolve) => require(['@/views/personnel/workshopScheduleShiftAttendanceStatistic/edit'], resolve),
			name: 'editWorkshopScheduleShiftAttendanceStatistic',
			meta: { title: '编辑-区域班次考勤记录', icon: '', activeMenu: '/personnel/workshopScheduleShiftAttendanceStatistic', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'detailWorkshopScheduleShiftAttendanceStatistic',
			component: (resolve) => require(['@/views/personnel/workshopScheduleShiftAttendanceStatistic/detail'], resolve),
			name: 'detailWorkshopScheduleShiftAttendanceStatistic',
			meta: { title: '区域班次考勤记录-详情', icon: '', activeMenu: '/personnel/workshopScheduleShiftAttendanceStatistic', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'addDailyScheduleShiftAttendanceStatistic',
			component: (resolve) => require(['@/views/personnel/dailyScheduleShiftAttendanceStatistic/add'], resolve),
			name: 'addDailyScheduleShiftAttendanceStatistic',
			meta: { title: '新增-班次考勤记录', icon: '', activeMenu: '/personnel/dailyScheduleShiftAttendanceStatistic', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'editDailyScheduleShiftAttendanceStatistic',
			component: (resolve) => require(['@/views/personnel/dailyScheduleShiftAttendanceStatistic/edit'], resolve),
			name: 'editDailyScheduleShiftAttendanceStatistic',
			meta: { title: '编辑-班次考勤记录', icon: '', activeMenu: '/personnel/dailyScheduleShiftAttendanceStatistic', affix: false }
		}]
	},
	{
		path: '',
		component: Layout,
		hidden: true,
		children: [{
			path: 'detailDailyScheduleShiftAttendanceStatistic',
			component: (resolve) => require(['@/views/personnel/dailyScheduleShiftAttendanceStatistic/detail'], resolve),
			name: 'detailDailyScheduleShiftAttendanceStatistic',
			meta: { title: '班次考勤记录-详情', icon: '', activeMenu: '/personnel/dailyScheduleShiftAttendanceStatistic', affix: false }
		}]
	},
	{
		path: '/ltGroupYieldStatistics',
		name: 'ltGroupYieldStatistics',
		hidden: true,
		component: (resolve) => require(['@/views/statisticAnalysis/ltGroupYieldStatistics/print'], resolve)
	}
];

// 防止连续点击多次路由报错
const routerPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(err => err);
};
/**
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user roles
 */
export const asyncRoutes = [];
export default new Router({
  base: '/',
  mode: 'history', // 去掉url中的#
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes.concat(asyncRoutes)
});
